<!DOCTYPE html>
<html>
<head>
    <title>${sysEn}-经销商加盟</title>
     <#include "/common/com_edit_css.ftl" >
</head>
<body>
    <div class="wrapper wrapper-content fadeInRight commoneditpage">
        <div class="row">
            <div class="col-lg-8 m-auto">
                <div class="ibox ">
                    <div class="ibox-title">
                        <h5>${actNm}-经销商加盟</h5>
                    </div>
                    <div class="ibox-content">
                        <form id="form" action="${ctx}/store_join_edit_submit.do" method="post">
                            <input type="hidden" name="id" id="id" value="${obj.id?c}">
                            <div class="form-group row"><label class="col-lg-2 col-form-label must">姓名：</label>
                                <div class="col-lg-10">
                                    <input type="text" placeholder=""
                                           value="${obj.name}"
                                           id="name" name="name" class="form-control"
                                           data-easyform="null"
                                           data-message-null="姓名不能为空" />
                                </div>
                            </div>
                             <div class="form-group row">
                                <label class="col-lg-2 col-form-label must">手机号：</label>
                                <div class="col-lg-10">
                                    <input type="text" placeholder="" id="phone"
                                           value="${obj.phone }"
                                           name="phone" data-easyform="null"
                                           data-message="手机号并不能为空"
                                           class="form-control" />
                                </div>
                            </div>
                             <div class="form-group row">
                                <label class="col-lg-2 col-form-label must">省：</label>
                                <div class="col-lg-10">
                                	<input type="hidden" id="cityCode" value="${obj.city }"/>
                                     <select class="form-control m-b" name="prov" id="prov"  onchange="altCitys()" >
		                            	<option value="">请选择省份...</option>
		                         
		                                <#list areaMap ?keys as key>
		                                   <#if key == obj.prov >
										    <option value=${key} selected="selected">${areaMap[key].name}</option>	
										  <#else>
										  	<option value=${key}>${areaMap[key].name}</option>	
										  </#if>			
										</#list>
	                            	</select>
                                </div>
                            </div>
                            <div class="form-group row">
                                <label class="col-lg-2 col-form-label must">市：</label>
                                <div class="col-lg-10">
                                      <select class="form-control m-b" name="city" id="city">
	       
	                            	  </select>
                                </div>
                            </div>
                            <div class="form-group row">
                                <label class="col-lg-2 col-form-label must">邮箱：</label>
                                <div class="col-lg-10">
                                    <input type="text" placeholder="" id="email"
                                           value="${obj.email }"
                                           name="email" data-easyform="null"
                                           data-message="邮箱并不能为空"
                                           class="form-control" />
                                </div>
                            </div>
                            <div class="form-group row">
                                <label class="col-lg-2 col-form-label must">公司名称：</label>
                                <div class="col-lg-10">
                                    <input type="text" placeholder="" id="companyName"
                                           value="${obj.companyName }"
                                           name="companyName" data-easyform="null"
                                           data-message="公司名称不能为空"
                                           class="form-control" />
                                </div>
                            </div>
                            <div class="form-group row">
                                <label class="col-lg-2 col-form-label" >提交：</label>
                                <div class="col-lg-10">
                                	<input type="text" id='applyTime' name='applyTime' value='${obj.applyTime?string("yyyy-MM-dd HH:mm")}'   readonly="readonly" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})" title='请选择活动时间'>
                                </div>
                            </div>
                           <div class="form-group row"><label class="col-lg-2 col-form-label">备注：</label>
                                <div class="col-lg-10">
                               	 	<textarea id="remark" name='remark' cols=60 rows=10  class="form-control" data-easyform="null;">${obj.remark}</textarea>
                                </div>
                            </div>
                            <div class="form-group row ">
                                <div class="col-lg-offset-2 col-lg-10">
                                    <button class="btn btn-sm btn-primary" type="button" id="signBtn" tg="ensure">确定</button>
                                    <button class="btn btn-sm btn-white" type="button" id="cancelBtn" tg="cancel">取消</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <#include "/common/com_edit_js.ftl">
        <script type="text/javascript" src="/js/plugins/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript">
        $('.i-checks').iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green',
        });
        $(document).ready(function () {
            EditPager.init({
                container:$("#form"),
                param:function () {
                    var id = $("#id").val();
                    return {
                        id:id?id:0,
						name:$("#name").val(),
						prov:$("#prov").val(),
						city:$("#city").val(),
						email:$("#email").val(),
						companyName:$("#companyName").val(),
						applyTime:$("#applyTime").val(),
						remark:$("#remark").val(),
                    };
                }
            });
            
            altCitys($("#cityCode").val());
        });

         function altCitys(code){
			$("#city").html("<option value=''>请选择城市...</option>");
			
			var prov = $("#prov").val();
			if(prov!=''){
				$.get("/ajaxGetAreaMap.do",{code:prov,type:"city"},function(data){
					var arr = "";
					var selected = "";
					for(var obj in data.data){
						if(code!=undefined && data.data[obj]["code"]==code){
							selected = "selected='selected'";
						}else{
							selected = "";
						}
						arr += "<option value='"+data.data[obj]["code"]+"' "+selected+">"+data.data[obj]["name"]+"</option>";
					}
					
					$("#city").append(arr);
				},"json");
			}
		}
    </script>
</body>
</html>
